<script type="text/javascript">
	if (typeof jQuery == 'undefined'){
		document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
	}
</script>
<style>
.best-sell-box{
	display:none;
}
</style>
<div class="best-sell-box">
	<h2><?php echo Mage::helper('marketplacepartner')->__('Latest Product Added') ?></h2>
</div>
<div class="best-sell-box">
	<span class="ed_nav ed_left"></span>
	<div class="best-sell">
	<?php
		$data=Mage::getModel('marketplacepartner/userdata')->getCollection()
									->addFieldToFilter('userid',array('eq'=>$_GET["id"]))
									->addFieldToFilter('mageproductid',array('neq'=>0))->setPageSize(9)
									->setOrder('mageproductid', 'DESC');
	   foreach($data as $data1){
			$rowdata[] = $data1->getid();
		}				
		foreach($rowdata as $productid ){
			$_product=Mage::getModel('catalog/product')->load($productid);
			if($_product->getName()!=""){
	?>
		<div class="best-sell-product">
			<a href="<?php echo $_product->getProductUrl()?>">
				<div class="image">
					<img src=<?php echo Mage::helper('catalog/image')->init($_product, 'image')->resize(265);?> alt="<?php echo ""?>" />
				</div>
			<div class="name"><?php echo $_product->getName() ?></div></a>
			<div class="price"><?php echo ("$".substr_replace($_product->getPrice(),"",-2)) ?></div>
		</div>
<?php
			}
	}
?>
	</div>
	<span class="ed_nav ed_right"></span>
</div>
<style>
.best-sell{width:<?php echo (181*sizeof($rowdata))?>px;}
</style>
<script>
	$wk_jq=jQuery.noConflict();
	$wk_jq(function(){
		if($wk_jq('.best-sell .best-sell-product').length > 0){
			$wk_jq('.best-sell-box').show();
		}
		var wk_slider=$wk_jq('.best-sell .best-sell-product').length;

		$wk_jq('.ed_right').click(function() {
			if(wk_slider>3)
			{
			var thisthis=$wk_jq(this).siblings('.best-sell');
			thisthis.animate({"left":"-=480"},1500);
			wk_slider=wk_slider-3;
			}
		});
		
		$wk_jq('.ed_left').click(function() {
			var thisthis=$wk_jq(this).siblings('.best-sell');
			if(wk_slider<$wk_jq('.best-sell .best-sell-product').length){
				thisthis.animate({"left":"+=480"},1500);
				wk_slider=wk_slider+3;
			}
		});
	});
</script>